<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport"
        content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta content="telephone=no" name="format-detection" />
    <!-- 留作将来统一添加 -->
    <TEMPLATE>${TEMPLATE}</TEMPLATE>
    <title>模板html</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../../css/index.css">
    <link rel="stylesheet" type="text/css" href="../../css/data-flex.min.css">
    <style type="text/css">
        html,body {
            background-color: transparent;
        }

        .box-white {
            position: absolute;
            left: 0;
            bottom: 0;
            width: 100%;
            background-color: #fff;
            border-radius: 20px 20px 0 0;
            overflow: hidden;
            padding: 0 15px;
        }

        .header {
            margin: 20px 0;
        }

        .caption {
            font-size: 16px;
            font-weight: 500;
            color: #333333;
        }

        .icon-close {
            width: 18px;
            height: 18px;
        }

        .hb-list {
            height: 500px;
            flex-wrap: wrap;
            overflow: scroll;
            margin: 0 -5px;
        }

        .hb-list .item {
            margin-bottom: 20px;
            width: 50%;
            padding: 0 5px;
        }

        .hb-list .cover {
            display: block;
            width: 100%;
            height: 220px;
            border-radius: 5px;
            margin-bottom: 10px;
        }

        .hb-list .title {
            font-size: 14px;
            font-weight: 400;
            color: #222224;
            line-height: 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 2;
            word-break: keep-all;
            word-wrap: break-word;
            -webkit-hyphens: none;
        }
    </style>
</head>

<body onclick="api.closeFrame()">
    <div class="vueApp" v-cloak>
        <div class="box-white">
            <div class="header" data-flex="cross:center main:justify">
                <div class="caption">选集({{info.listData.length}}套)</div>
                <img src="../../image/ui/close.png" onclick="api.closeFrame()" alt="" class="icon-close">
            </div>
            <div class="hb-list" data-flex="main:justify">
                <div class="item" v-for="item,index in info.listData" @click="handleItem(index)">
                    <img :src="item.pbookPic"
                        alt="" class="cover">
                    <div class="title">{{ item.pbookName }}</div>
                </div>
            </div>
        </div>
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/service/service-tool.js"></script>
<script type="text/javascript" src="../../script/service/service-app.js"></script>
<script type="text/javascript" src="../../script/service/service-user.js"></script>
<script type="text/javascript" src="../../script/service/service-logic.js"></script>
<script type="text/javascript" src="../../script/jquery.min.js"></script>
<script type="text/javascript" src="../../script/vue.min.js"></script>
<script type="text/javascript">
    // html 的引号一律为双引号(""),js 为单引号('')
    var USER, $S, vm, pageParam;
    apiready = function () {
        $S = SERVICE();
        USER = USER();
        console.log(JSON.stringify(api.pageParam) + '=====pageParam');
        pageParam = api.pageParam;
        fnInit();
    };

    // 初始化
    function fnInit() {
        vm = new Vue({
            el: '.vueApp',
            data: {
                info: pageParam.info
            }
        });
    }

    // 点击列表
    function handleItem(index) {
        var item = vm.info.listData[index];
        // 如果没做过
        if(typeof item.scoreValue == 'null' || typeof item.scoreValue == 'undefined' || item.scoreValue == '') {
            var params = {
                isBtn: false,
                btnName: '练习题',
                headerFn: 'headerFn',
                catalogId: item.catalogId,
                itemId: item.id,
                index: index,
                hbId: vm.hbId,
                info: vm.info,
                isConfigQuestion: item.isConfigQuestion,
                isActivate: vm.info.isActivate
            };
            fnOpenPublicWin(item.pbookName, 'video/hb_start', params);
        } else {
            fnOpenWin({
                name: 'hb_end_win',
                url: './hb_end.html',
                pageParam: {
                    info: vm.info,
                    score: item.scoreValue,
                    index: index,
                    hbId: vm.hbId
                }
            });
        }
    }
</script>

</html>